		var code;
        function createCode() {
            code = "";
            var codeLength = 6; //验证码的长度
            var checkCode = document.getElementById("checkCode");
            var codeChars = new Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 
            'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
            'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); //所有候选组成验证码的字符，当然也可以用中文的
            for (var i = 0; i < codeLength; i++) 
            {
                var charNum = Math.floor(Math.random() * 52);
                code += codeChars[charNum];
            }
            if (checkCode) 
            {
                checkCode.className = "code";
                checkCode.innerHTML = code;
            }
        }
        function validateCode()
        {
            var inputCode = document.getElementById("inputCode").value;
            var flag = true;
            if (inputCode.length <= 0)
            {
                alert("亲，是不是忘记输入验证码啦。");
                flag = false;
            }
            else if (inputCode.toUpperCase() != code.toUpperCase()) 
            {
                alert("亲，验证码好像不对哦。");
                createCode();
                flag = false;
            }
            else
            {
            	flag = checkInput();
            }
            
            return flag;
            
        }
        
        function checkInput() {
        	var username = document.getElementById("username").value;
        	var password = document.getElementById("password").value;
        	var password2 = document.getElementById("password2").value;
        	
        	var flag = true;
        	if(username.length<=0) {
        		alert("亲，是不是忘记输入用户名了？");
        		flag = false;
        	}
        	else if(username.length<3 || username.length>10) {
        		alert("亲，用户名长度不合法哦。");
        		flag = false;
        	}else {
        		
        		if(password.length<=0) {
            		alert("亲，是不是忘记输入密码了？");
            		flag = false;
            	}
            	
            	else if(password.length<6 || password.length>10) {
            		alert("亲，密码长度不合法哦。");
            		flag = false;
            	}
            	else {
            		if(password2.length<=0) {
                		alert("亲，是不是忘记输入确认密码了？");
                		flag = false;
                	}
                	else if(password != password2) {
                		alert("亲，两次密码输入不一致哦。");
                		flag = false;
                	}
            	}
        		
        	}
        	
        	return flag;
        	
        }
        
        
        
        function validateCodeLogin()
        {
            var inputCode = document.getElementById("inputCode").value;
            var flag = true;
            if (inputCode.length <= 0)
            {
                alert("亲，是不是忘记输入验证码啦。");
                flag = false;
            }
            else if (inputCode.toUpperCase() != code.toUpperCase()) 
            {
                alert("亲，验证码好像不对哦。");
                createCode();
                flag = false;
            }
            else
            {
            	flag = checkInputForLogin();
            }
            
            return flag;
            
        }
        
        function checkInputForLogin() {
        	
        	
        	var username = document.getElementById("username").value;
        	var password = document.getElementById("password").value;
        	
        	
        	var flag = true;
        	if(username.length<=0) {
        		alert("亲，是不是忘记输入用户名了？");
        		flag = false;
        	}
        	else if(username.length<3 || username.length>10) {
        		alert("亲，用户名长度不合法哦。");
        		flag = false;
        	}else {
        		
        		if(password.length<=0) {
            		alert("亲，是不是忘记输入密码了？");
            		flag = false;
            	}
            	
            	else if(password.length<6 || password.length>10) {
            		alert("亲，密码长度不合法哦。");
            		flag = false;
            	}
        		
        	}
        	
        	return flag;
        }
        
        
        //上传图片校检
        function checkUploadImg()
        { 
        	
        	var file = document.getElementById("uploadPhoto").value;
        	
        	if(file=="")
        	{ 
        		alert("还没选择要上传的照片呢");
        		return false;
        	} 
        	var strTemp = file.split(".");
        	var strCheck = strTemp[strTemp.length-1];
        	if(strCheck.toUpperCase()=='JPG' || strCheck.toUpperCase()=='JIF' || strCheck.toUpperCase()=='PNG' 
        		|| strCheck.toUpperCase()=='JPEG')
        	{ 
        		return true;
        	}
        	else
        	{ 
        		alert("你确定你选择的文件是图片？");
        		return false;
        	} 
        }
        
        
        
        
        
        
        
        